$(function () {

    var lineData = {
        labels: rd,
        datasets: [

            {
                label: "充值(¥)",
                backgroundColor: 'rgba(26,179,148,0.5)',
                borderColor: "rgba(26,179,148,0.7)",
                pointBackgroundColor: "rgba(26,179,148,1)",
                pointBorderColor: "#fff",
                data: rm
            },{
                label: "缴费(¥)",
                backgroundColor: 'rgba(255,0,0, 0.5)',
                borderColor: 'rgba(255,0,0, 0.8)',
                pointBorderColor: "#fff",
                data: pm
            },{
                label: "充值次数",
                backgroundColor: 'rgba(106,90,205, 0.5)',
                borderColor: 'rgba(106,90,205, 0.8)',
                pointBorderColor: "#fff",
                data: rs
            }
        ]
    };

    var lineOptions = {
        responsive: true
    };


    var ctx = document.getElementById("lineChart").getContext("2d");
    new Chart(ctx, {type: 'line', data: lineData, options:lineOptions});


    var barData = {
        labels: ed,
        datasets: [
            {
                label: "增加参保企业",
                backgroundColor: 'rgba(220, 220, 220, 1)',
                borderColor: "rgba(220, 220, 220,1)",
                pointBackgroundColor: "rgba(220, 220, 220,1)",
                pointBorderColor: "#fff",
                data: es
            },
            {
                label: "增加参保人员",
                backgroundColor: 'rgba(26,179,148,0.5)',
                borderColor: "rgba(26,179,148,0.7)",
                pointBackgroundColor: "rgba(26,179,148,1)",
                pointBorderColor: "#fff",
                data:us
            }
        ]
    };

    var barOptions = {
        responsive: true
    };


    var ctx2 = document.getElementById("barChart").getContext("2d");
    new Chart(ctx2, {type: 'bar', data: barData, options:barOptions});

    // Simple pie chart

    var data = {
        labels: yed,
        series: yes
    };

    var options = {
        labelInterpolationFnc: function(value) {
            return value[0]
        }
    };

    var responsiveOptions = [
        ['screen and (min-width: 640px)', {
            chartPadding: 30,
            labelOffset: 100,
            labelDirection: 'explode',
            labelInterpolationFnc: function(value) {
                return value;
            }
        }],
        ['screen and (min-width: 1024px)', {
            labelOffset: 30,
            chartPadding: 20
        }]
    ];

    new Chartist.Pie('#ct-chart5', data, options, responsiveOptions);

    // Simple pie chart

    var data = {
        labels: yud,
        series: yus
    };

    var options = {
        labelInterpolationFnc: function(value) {
            return value[0]
        }
    };

    var responsiveOptions = [
        ['screen and (min-width: 640px)', {
            chartPadding: 30,
            labelOffset: 100,
            labelDirection: 'explode',
            labelInterpolationFnc: function(value) {
                return value;
            }
        }],
        ['screen and (min-width: 1024px)', {
            labelOffset: 30,
            chartPadding: 20
        }]
    ];

    new Chartist.Pie('#ct-chart6', data, options, responsiveOptions);

    var polarData = {
        datasets: [{
            data: yes,
            backgroundColor: [
                "#a3e1d4", "#dedede", "#b5b8cf","#a3e1d4", "#dedede", "#b5b8cf"
            ],
            label: [
                "My Radar chart"
            ]
        }],
        labels:yed,
    };

    var polarOptions = {
        segmentStrokeWidth: 2,
        responsive: true,
        segmentShowStroke : true

    };

    var ctx3 = document.getElementById("polarChart").getContext("2d");
    new Chart(ctx3, {type: 'pie', data: polarData, options:polarOptions});

    var doughnutData = {
        labels: ["App","Software","Laptop" ],
        datasets: [{
            data: [300,50,100],
            backgroundColor: ["#a3e1d4","#dedede","#b5b8cf"]
        }]
    } ;


    var doughnutOptions = {
        responsive: true
    };


    var ctx4 = document.getElementById("doughnutChart").getContext("2d");
    new Chart(ctx4, {type: 'doughnut', data: doughnutData, options:doughnutOptions});


    var radarData = {
        labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
        datasets: [
            {
                label: "My First dataset",
                backgroundColor: "rgba(220,220,220,0.2)",
                borderColor: "rgba(220,220,220,1)",
                data: [65, 59, 90, 81, 56, 55, 40]
            },
            {
                label: "My Second dataset",
                backgroundColor: "rgba(26,179,148,0.2)",
                borderColor: "rgba(26,179,148,1)",
                data: [28, 48, 40, 19, 96, 27, 100]
            }
        ]
    };

    var radarOptions = {
        responsive: true
    };

    var ctx5 = document.getElementById("radarChart").getContext("2d");
    new Chart(ctx5, {type: 'radar', data: radarData, options:radarOptions});

});